<?php echo $this->Session->flash(); ?>
<script>
    $(document).ready(function(){
        selectDiv();
        $('#parent').change(function() {
       
            selectDiv();

        });

    });

    function selectDiv(){
        if($('#parent option:selected').val()==9){
            $('#otro').show("slow");
            $('#otro').attr('disabled','');

        }else{
              
            $('#otro').hide("slow");
            $('#otro').attr('disabled','disabled');
            $('#otro').attr('value','¿cual?')
        }
    }

</script>
<h1 align="center">ADICIONAR FAMILIAR</h1>

<fieldset>
    <h1>ADICIONAR  <?php echo " FAMILIAR DE: " . $nombre['Candidate']['1er_nombre'] . " " . $nombre['Candidate']['1er_apellido'] . " " . $nombre['Candidate']['2do_apellido']; ?></h1>

    <?php
    $estado = "";
    echo $form->create('Relative');

    echo $form->hidden("Relative.candidate_id");
    echo $form->input('Relative.tipo_ident', array('empty' => __('Seleccione ', true), 'label' => "Tipo identificación", 'type' => 'select', 'options' => array(1 => 'C.C', 2 => 'T.I', 3 => 'Registro civil', 4 => 'NUI')));
    echo $form->input('Relative.parentesco', array('empty' => __('Seleccione ', true), 'label' => "Parentesco", 'type' => 'select', 'id' => 'parent', 'options' => array(1 => 'Hijo(a)', 2 => 'Hijastro(a)', 3 => 'Padre', 4 => 'Madre', 5 => 'Abuelo(a)', 6 => 'Nieto(a)', 7 => 'Primo(a)', 8 => 'Sobrino(a)', 9 => 'Conyugue', 10 => 'Hermano(a)', 11 => 'Otro')));
    echo $form->input("Relative.otro", array('id' => 'otro', 'label' => ''));
    echo $form->input("Relative.nro_ident", array('readonly' => $estado));
    echo $form->input("Relative.nombres", array('readonly' => $estado));
    echo $form->input("Relative.1er_apellido", array('readonly' => $estado));
    echo $form->input("Relative.2do_apellido", array('readonly' => $estado));
    echo $form->input('Relative.genero', array('empty' => __('Seleccione ', true), 'label' => "Genero", 'type' => 'select', 'options' => array(1 => 'Hombre', 2 => 'Mujer')));
    ?>
    <div id="loading" style="display: none;">
        <?php echo $html->image('load2.gif', array('border' => "0", 'align' => 'center')); ?>
    </div>
    <?php
    echo $ajax->submit('Guardar', array('url' => array('controller' => 'Relatives', 'action' => 'add', $this->data['Relative']['candidate_id'], $tipo), 'update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading'));
    echo $form->end();
    ?>
</fieldset>
<div id="loader" style="display:none;">
    <?php echo $html->image('loading.gif', array('alt' => 'CakePHP')) ?>
</div>